{extend name="layout" /}
{block name="content"}
<form class="layui-form" lay-filter="LAY-app-content-list-form" id="LAY-app-content-list-form" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">分类</label>
        <div class="layui-input-inline">
            <select name="category_id" lay-verify="required">
                <option value="">请选择</option>
                {foreach $categories as $key=>$vo }
                <option value="{$vo.id}" {if isset($article['category_id']) && $vo['id'] == $article['category_id']}selected{/if}>{$vo.html}{$vo.name}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">标题</label>
        <div class="layui-input-block">
            <input type="text" name="title" value="{$article.title|default=''}" lay-verify="required"
                       placeholder="请输入标题" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">关键词</label>
        <div class="layui-input-block">
            <input type="text" name="keywords" value="{$article.keywords|default=''}" placeholder="请输入关键字"
                   autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">摘要</label>
        <div class="layui-input-block">
            <textarea name="description" class="layui-textarea">{$article.description|default=''}</textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">缩略图</label>
        <div class="layui-input-inline">
            <input type="text" name="thumbnail" value="{$article.thumbnail|default=''}"
                   placeholder="请选择..." autocomplete="off" class="layui-input" id="picture">
        </div>
        <button style="float: left;" type="button" class="layui-btn" onClick="upImage()">上传图片</button>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">内容</label>
        <div class="layui-input-inline">
            <script id="container" name="content" type="text/plain" style="width: 800px;height: 300px;">{$article.content|raw|default=""}</script>
        </div>
    </div>

    <input type="hidden" name="more[photo]">
    <div class="layui-form-item">
        <label class="layui-form-label">附件</label>
        <div class="layui-input-inline">
            <input type="text" name="more[file]" value="{$article.more.file|default=''}"
                   placeholder="请选择..." autocomplete="off" class="layui-input" id="file">
        </div>
        <button style="float: left;" type="button" class="layui-btn" onClick="upFile()">选择文件</button>
    </div>
    <input type="hidden" name="more[audio]">
    <input type="hidden" name="more[video]">

    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-inline">
            <input type="checkbox" lay-verify="required" lay-filter="status" name="status" lay-skin="switch"
                   lay-text="已发布|待修改">
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-app-content-list-submit" id="LAY-app-content-list-submit" value="确认">
    </div>
</form>
{include file='editor' /}{/block}
{block name="js"}
<script>
    layui.use(['index', 'form'], function(){
        var $ = layui.$
            ,form = layui.form
            ,admin = layui.admin;

        <!-- 实例化编辑器 -->
        var ue = UE.getEditor('container');
        ue.ready(function () {
            //设置内容
            //ue.setContent(decodeURIComponent(content));
        });
    })
</script>
<style>
    .layui-form-select dl {
        z-index: 100000000 !important
    }
</style>
{/block}